package com.ipodao.xiaohu.biquan;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author ipodao@qq.com
 * @date 2019/1/30 14:12
 */
@Controller
public class BiQuanCollection {
    @ResponseBody
    @RequestMapping("/ticker")
    public String ticker(String convert,String start,String limit) {
        StringBuffer urlBuffer= new StringBuffer();
        urlBuffer.append("https://public.bqi.com/public/v1/ticker?isKLine=1");
        if(null!=convert){
            urlBuffer.append("&convert="+convert);
        }
        if(null!=start){
            urlBuffer.append("&start="+Integer.valueOf(start));
        }
        if(null!=limit){
            urlBuffer.append("&limit="+Integer.valueOf(limit));
        }
        String biqianval= HttpUtil.sendGet(urlBuffer.toString());
        return biqianval;
    }
    @ResponseBody
    @RequestMapping("/exchange")
    public String exchange(String code,String start,String limit){
        StringBuffer urlBuffer= new StringBuffer();
        urlBuffer.append("https://public.bqi.com/public/v1/exchange?test=1");
        if(null!=code){
            urlBuffer.append("&code="+code);
        }
        if(null!=start){
            urlBuffer.append("&start="+Integer.valueOf(start));
        }
        if(null!=limit){
            urlBuffer.append("&limit="+Integer.valueOf(limit));
        }
        String biqianval= HttpUtil.sendGet(urlBuffer.toString());
        return biqianval;
    }
}
